package com.example.weathersuggestion;

import java.util.ArrayList;

/* This class holds the structures to hold the suggestions for each temperature range
 * Utility class - will be passed strings that will hold the temperature and precipitation percentage
 * and then will provide the correct String array hold the clothing and activity suggestions
 * @author Ryan Barr
 */
public abstract class Suggestion {
	
	private double temp;

	private boolean precipitation;
	
	protected double getTemp(){
		return this.temp;
	}
	
	protected boolean getPrecip(){
		return precipitation;
	}
	
	protected void setPrecip(boolean precip){
		this.precipitation = precip;
	}

	protected void setTemp(double temp) {
		this.temp = temp;
	}
	
	/**
	 * Private class to convert String to double for weather input
	 * Provides error catch if String can't be resolved to double.
	 * @param s String to be converted
	 * @return double value of converted string
	 */
	protected double convertStringToDouble(String s){
		
		double temporary;
		try{
			temporary = Double.parseDouble(s);
		}
		catch(NumberFormatException e){
			//error catch: String unsuccessfully converted to double
			e.printStackTrace();
			return -1;
		}
		return temporary;
	
	}
	
	/*
	 * Class to get suggestions abstract so both can implement
	 * @param tempStr temperature passed as a String
	 * @param precip precipitation passed as a String
	 * @returns String of suggestion
	 */
	public abstract ArrayList<String> getSuggestion(Double temp, Double precip);


}